import {
  createRouter,
  createWebHashHistory,
} from "vue-router";

const router = createRouter({
  history: createWebHashHistory(),
  routes: [
    {
      path: "/",
      redirect: "/home/goods",
    },
    {
      path: "/home",
      name: "Home",
      component: () => import("@/views/Home.vue"),
      children: [
        {
          path: "goods",
          name: "Goods",
          component: () => import("@/views/goods/GoodsMg.vue"),
        },
        {
          path: "local",
          name: "Local",
          component: () => import("@/views/location/LocalMg.vue"),
        },
        {
          path: "tags",
          name: "Tags",
          component: () => import("@/views/tags/TagsMg.vue"),
        },
        {
          path: "users",
          name: "Users",
          component: () => import("@/views/user/UsersMg.vue"),
        },
      ],
    },
    {
      path: "/login",
      name: "login",
      component: () => import("@/views/Login.vue"),
    },
    {
      path: "/404",
      name: "404",
      component: () => import("@/views/404.vue"),
    },
    {
      path: "/:catchAll(.*)",
      redirect: "/404",
    },
  ],
});

export default router;
